<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('回复信件工单')"/>
    <style>
        label {
            font-weight: bold;
        }

        @font-face {
            font-family: 'huawen';
            src: url("/fonts/huawen.woff2");
        }
    </style>
</head>

<body style="background-color: #F4F6FA;font-size: 13px;font-family:'huawen' ;font-weight: bold">
<div class="main-content" style="margin: 0;padding: 0">

    <form id="form-user-add" th:object="${sendBackEty}" class="form-horizontal" style="background-color: #F4F6FA">
        <input type="hidden" th:field="*{wfId}"/>
        <input type="hidden" th:field="*{pkId}"/>
        <input type="hidden" th:field="*{sortCode}"/>
        <input type="hidden" th:field="*{sdeptName}"/>
        <input type="hidden" th:field="*{sdeptId}"/>
        <input type="hidden" id="crtUserRole" th:value="${user.roles.get(0).roleId}"/>
        <input type="hidden" name="crtStepId" id="crtStepId" />
        <input type="hidden" name="crtStepName" id="crtStepName" />

        <div class="col-sm-12" style="display: flex">
            <div class="entering-page" style="overflow:hidden;">
                <!--    回复电话工单    -->
                <div class="col-sm-12 tltieBoder">
                    <div class="blueBorder"></div>
                    <h4 style="margin:0 0 0 10px">回复信件工单 <a th:if="${ySpare != null && #strings.length(ySpare) > 10}" class="btn btn-sm btn-primary" onclick="lookImage(this)">查看图片</a></h4>
                </div>
                <div style="display:none;">
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="col-sm-2 control-label entering-pd">建议办结及理由：</label>
                            <div class="col-sm-10">
                                <textarea th:field="*{reason}" maxlength="1000"
                                          class="form-control"
                                          cols="60"
                                          rows="3"></textarea>
                            </div>
                        </div>

                    </div>
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="col-sm-2 control-label entering-pd" style="color: red">执行处(科)室：</label>
                            <div class="col-sm-10">
                                <input th:field="*{bdutyDept}" type="text" class="form-control" >
                            </div>
                        </div>
                    </div>
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="col-sm-2 control-label entering-pd" style="color: red">联系电话：</label>
                            <div class="col-sm-10">
                                <input th:field="*{bdutyTel}" type="text" class="form-control" >
                            </div>
                        </div>
                    </div>
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="col-sm-2 control-label entering-pd">回复人：</label>
                            <div class="col-sm-10">
                                <input name="buserName" th:value="${user.userName}" type="text" class="form-control" >
                                <input type="hidden" name="buserNo" th:value="${user.userNo}"/>
                            </div>
                        </div>
                    </div>
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="col-sm-2 control-label entering-pd">回复时间：</label>
                            <div class="col-sm-10">
                                <input name="backTime" th:value="${nowTime}" type="text" class="form-control" >
                            </div>
                        </div>
                    </div>
                    <div class="col-sm-12">
                    <div class="form-group">
                        <label class="col-sm-2 control-label entering-pd">备注：</label>
                        <div class="col-sm-10">
                            <input th:field="*{backRemark}" type="text" class="form-control" >
                        </div>
                    </div>
                </div>
                </div>
                <div class="col-sm-12">
                    <div class="form-group">
                        <label class="col-sm-2 control-label entering-pd" style="color: red">回复内容:</br>(供主办单位参考):</label>
                        <div class="col-sm-10">
                            <textarea id="backDesc" th:field="*{backDesc}" maxlength="3500"
                                      class="form-control"
                                      cols="100"
                                      rows="7" required="required"></textarea>
                        </div>
                    </div>
                </div>
                <!--按钮-->
<!--                <div class="col-sm-12" style="display: flex;justify-content:center;margin:15px 0px 15px 0px">-->
<!--                    <div class="form-group">-->
<!--                        <div class="col-sm-3" style="display: flex;justify-content: space-evenly;">-->
<!--                            <button type="button" class="btn btn-sm btn-success" onclick="sub()">回复</button>&nbsp;&nbsp;&nbsp;&nbsp;-->
<!--                            <button type="button" class="btn btn-sm btn-light" onclick="parent.closeItem()">关闭</button>-->
<!--                        </div>-->
<!--                    </div>-->
<!--                </div>-->
            </div>
        </div>
    </form>
</div>
<input type="hidden" id="ySpare" name="ySpare" th:value="${ySpare}" />
<input type="hidden" id="wsCode" name="wsCode" th:value="${wsCode}" />
<th:block th:include="include :: footer"/>
<script>
    var prefix = ctx + "system/mMailWF";

    function submitHandler(index){
        //回复内容不能为空
        if($("#backDesc").val().length<1){
            parent.$.modal.alertWarning("回复内容不能为空");
            return false;
        }
        //根据当前登录用户的角色决定由哪个部门审查
        var stepRoles = "210,240,260,290,310,340";
        var crtRole = $("#crtUserRole").val();
        if(stepRoles.indexOf(crtRole) > -1){
            $("#crtStepId").val("800");
            $("#crtStepName").val("待市级部门审查");
        }
        else{ //三级不驱动流程
            $("#crtStepId").val("400");
            $("#crtStepName").val("待区县部门审查");
        }

        if ($.validate.form()) {
            let url = prefix + "/cmnFile/dlReplyS";
            let data = $('#form-user-add').serializeArray();
            $.ajax({
                url:url,
                type:"post",
                data : data,
                success : function(result) {
                    $.modal.msgSuccess(result.msg);
                    $.modal.close();
                    refreshNotSignList();
                }
            })
        }
    }

    // 刷新待签收列表
    function refreshNotSignList() {
        var navFrame = $('.NAP_iframe[data-id="/system/mMailWF/cmnFile/signNotList"]', parent.document)[0];
        navFrame.contentWindow.$.table.refresh();
    }
</script>
</body>
</html>

